package mx.com.switz.dao.impl;



import java.util.List;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.stereotype.Repository;

import mx.com.switz.dao.UsuarioDao;
import mx.com.switz.dto.Usuario;

@Repository
public class UsuarioDaoImpl extends JdbcDaoSupport implements UsuarioDao{
	



	@Autowired
	public UsuarioDaoImpl(DataSource dataSource) {
		setDataSource(dataSource);
		//this.jdbcTemplate = new JdbcTemplate(dataSource);

	//	this.simpleJdbcInsert=new SimpleJdbcInsert(dataSource);
		
	}
		
	
	@Override
	public List<Usuario> selectUsuario(String nombre) {
		
		String sql="select * from usuario where nombre=?";
		
		List<Usuario> guarda=getJdbcTemplate().query(sql,new Object[]{nombre},ParameterizedBeanPropertyRowMapper.newInstance(Usuario.class));
		
		
		return guarda;
	}
	
	

}
